/*************************************************************************
	> File Name: 1.fork.c
	> Author: WangYiFei
	> Mail: 824537320@qq.com
	> Created Time: Sun 10 Jan 2021 05:30:01 PM CST
 ************************************************************************/
#include "head.h"
#include <sys/wait.h>
#include <stdlib.h>

int main() {
    pid_t pid;
    int status;
    if ((pid = fork()) < 0) {
        perror("fork()");
        exit(1);
    }
    if (pid == 0) {
        printf("Child Process\n");
        // return 1;
        exit(2);
    } else {
        printf("Parent Process!\n");
        wait(&status);
        // if (WIFEXITED(status)) {
        //     printf("%d\n", WEXITSTATUS(status));
        // }
        printf("Wait Status = %d\n", status);
    }
    
        
    return 0;
}
